package com.koron.css2.baseConfig.impl;

import com.koron.css2.ServerInterface;
import com.koron.css2.baseConfig.mapper.UserTypeMapper;
import com.koron.css2.baseConfig.vo.SelectVO;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.util.Constant;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;

import java.util.List;

public class UserTypeSelect implements ServerInterface {

    @Override
    public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
        @SuppressWarnings("rawtypes")
        MessageBean<List> info = MessageBean.create(Constant.MESSAGE_INT_SUCCESS, "success", List.class);
        try {
            UserTypeMapper mapper = factory.getMapper(UserTypeMapper.class);
            // 获取下拉框 
            List<SelectVO> list = mapper.selectVo();
            info.setData(list);
            return info;
        } catch (Exception e) {
            logger.error("用户特殊类型查询失败" + e.getMessage(), e);
            return MessageBean.create(Constant.MESSAGE_INT_FAIL, "用户特殊类型查询失败", null);
        }
    }
}
